//
// Created by Administrator on 2021/11/20.
//

#ifndef LEARNREALTIMERENDERING_TRANSFORM_H
#define LEARNREALTIMERENDERING_TRANSFORM_H

#include "Geometry.hpp"

class Transform
{
public:
    const Vec3f& position() const { return m_position; }
    Vec3f& position()
    {
        m_l2wDirty = true;
        return m_position;
    }
    const Vec3f& rotation() const { return m_rotation; }
    Vec3f& rotation()
    {
        m_l2wDirty = true;
        return m_rotation;
    }
    const Vec3f& scale() const { return m_scale; }
    Vec3f& scale()
    {
        m_l2wDirty = true;
        return m_rotation;
    }

    Vec3f forward();
    Vec3f up();
    Vec3f right();

    const Mat4x4f& localToWorldMatrix();

    bool l2wDirty() const { return m_l2wDirty; }

private:
    Vec3f m_position;
    Vec3f m_rotation;
    Vec3f m_scale = {1.0f, 1.0f, 1.0f};
    Mat4x4f m_localToWorldMatrix;

    bool m_l2wDirty = true;
};

#endif //LEARNREALTIMERENDERING_TRANSFORM_H
